<template>
  <div class="wrapper">
  <swiper :options="swiperOption" v-if="showSwiper">
    <!-- slides -->
    <swiper-slide v-for="
    item
    of
    imgList"
    :key="item.id" >
      <img :src="item.url"/>
    </swiper-slide>
    <!-- Optional controls -->
    <div class="swiper-pagination"  slot="pagination"></div>
  </swiper>
  </div>
</template>

<script>
export default {
  name: 'HomeSwiper',
  props: {
    imgList: Array
  },
  data: function () {
    return {
      swiperOption: {
        pagination: '.swiper-pagination',
        speed: 300,
        loop: true
      }
    }
  },
  computed: {
    showSwiper: function () {
      return this.imgList.length
    }
  }
}

</script>

<style lang="stylus" scoped>
  .wrapper >>> .swiper-pagination-bullet-active
    background: #fff
  .wrapper
    overflow: hidden
    height: 0
    width: 100%
    padding-bottom: 30%
    background: #eee
    img
      width: 100%
</style>
